package com.codechuan.hallo.controller;

import com.codechuan.hallo.dto.CityInfo;
import com.codechuan.hallo.thread.ObtainOrderThread;
import com.codechuan.hallo.thread.SynContainer;
import com.codechuan.hallo.utils.CommonUtil;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RequestMapping(value = "/qd")
@RestController
public class StartController {

    @GetMapping(value = "/start")
    private String startQd (Integer sleep){
        SynContainer synContainer = new SynContainer();
        CityInfo cityInfo = CommonUtil.getCityInfo("广东省广州市天河区");
        cityInfo.setCityId("020");
        new Thread(new ObtainOrderThread(synContainer,cityInfo,sleep), "线程1").start();
        new Thread(new ObtainOrderThread(synContainer,cityInfo,sleep), "线程2").start();
        return "延时是:" + sleep;
    }
}
